#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "loader.h"
#include "saver.h"
#include "geometrydata.h"
#include <QThread>
#include "mygraphview.h"
#include "meshitem.h"
#include "triangletreemodel.h"
#include <QTreeWidget>

class QGraphicsScene;
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
public slots:
    void onOpenDefault();
    void progressChanged(int, QString message);
    void stopLoad();
    void stopSave();
    void onEnableColor(bool);
    void onEnableText(bool);
    void onEnableGrid(bool);
    void onEnableMesh(bool);
    void onPointValueChanged(double);
    void onParamValueChanged(int);
    void onSave();
    void onInitialTriangulation();
    void onSharpTriangulation();
    void onDoCalculation();
    void onAutoBounds();

    void onMeshItemSelected(MeshItem *it);
    
private:
    void startLoad(QString fileName);
    void startSave(QString fileName);
    void vizualizeScene();


    Ui::MainWindow *ui;
    QGraphicsScene *scene;
    MyGraphView *view;

    GeometryData data;
    Loader *loader;
    Saver *saver;
    QThread loader_thread;
    QTreeWidget * treeWidget;
    TriangleTreeModel *treemodel;

};

#endif // MAINWINDOW_H
